package chapter8;

import static utility.Print.*;

/**
 * Exercise 1: (2) Create a Cycle class, with subclasses Unicycle, Bicycle and
 * Tricycle. Demonstrate that an instance of each type can be upcast to Cycle
 * via a ride( ) method.
 * 
 * @author rDiaconescu
 * 
 */

class Cycle {
	public void ride() {
		print("General riding");
	}
}

class Unicycle extends Cycle {
	public void ride() {
		print("uni riding");
	}
}

class Bicycle extends Cycle {
	public void ride() {
		print("bi riding");
	}
}

class Tricycle extends Cycle {
	
}

public class Exercise1 {
	static void ride(Cycle c) {
		c.ride();
	}
	
	public static void main(String[] args) {
		Bicycle b = new Bicycle();
		Unicycle c = new Unicycle();
		Tricycle d = new Tricycle();
		
		ride(b);
		ride(c);

	}

}
